package cn.bonoon.controllers.place;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.bonoon.core.plugins.PlaceService;
import cn.bonoon.entities.PlaceEntity;
import cn.bonoon.kernel.web.annotations.grid.GridStandardDefinition;
import cn.bonoon.kernel.web.controllers.AbstractGridController;

@Controller
@RequestMapping("/s/sys/place")
public class PlaceController extends AbstractGridController<PlaceEntity, PlaceItem> {
	private final PlaceService service;

	@Autowired
	public PlaceController(PlaceService service) {
		super(service);
		this.service = service;
	}

	@Override
	protected Class<PlaceItem> itemClass() {
		return PlaceItem.class;
	}

	@Override
	@GridStandardDefinition(
			insertClass = PlaceEditor.class, 
			updateClass = PlaceEditor.class, 
			detailClass = PlaceDetail.class)
	protected PlaceService initLayoutGrid(LayoutGridRegister register) throws Exception {
		return service;
	}

}
